package com.mall.shopping.dto;

import com.mall.commons.result.AbstractRequest;
import com.mall.commons.tool.exception.ValidateException;
import com.mall.commons.tool.utils.ObjectIsEmptyUtils;
import com.mall.shopping.constants.ShoppingRetCode;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 类<code>Doc</code>用于：TODO
 *
 * @author Acher
 * @version 1.0
 * @date 2021-11-03
 */
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@Data
public class SearchContentRequest extends AbstractRequest {

    private String key;
    private Integer size;
    private Integer page;
    private String sort;
    private String priceGt;
    private String priceLte;

    @Override
    public void requestCheck() {
        if (ObjectIsEmptyUtils.stringIsEmpty(key)) {
            throw new ValidateException(ShoppingRetCode.REQUISITE_PARAMETER_NOT_EXIST.getCode(),ShoppingRetCode.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
    }
}
